<?php
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                                   ATTENTION!
 * If you see this message in browser (Internet Explorer, Mozilla firefox, etc.)
 * this means that
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 */


    require_once 'components/utils/check_utils.php';
    CheckPHPVersion();



    require_once 'database_engine/mysql_engine.php';
    require_once 'components/page.php';
    require_once 'phpgen_settings.php';
    require_once 'authorization.php';

    function GetConnectionOptions()
    {
        $result = GetGlobalConnectionOptions();
        $result['client_encoding'] = 'utf8';
        GetApplication()->GetUserAuthorizationStrategy()->ApplyIdentityToConnectionOptions($result);
        return $result;
    }

    
    ?><?php
    
    ?><?php
    
    class permohonan_kursusPage extends Page
    {
        protected function DoBeforeCreate()
        {
            $this->dataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`permohonan_kursus`');
            $field = new IntegerField('id');
            if (!$this->GetSecurityInfo()->AdminGrant())
              $field->SetReadOnly(true, GetApplication()->GetCurrentUserId());
            $this->dataset->AddField($field, true);
            $field = new StringField('nama');
            $this->dataset->AddField($field, false);
            $field = new IntegerField('noic');
            $this->dataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $this->dataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $this->dataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $this->dataset->AddField($field, false);
            $field = new StringField('anjuran');
            $this->dataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $this->dataset->AddField($field, true);
            $field = new DateField('tarikh_tamat');
            $this->dataset->AddField($field, true);
            $field = new IntegerField('bil_hari');
            $this->dataset->AddField($field, true);
            $field = new DateField('tarikh_key_in');
            $this->dataset->AddField($field, true);
            $field = new StringField('disahkan');
            $this->dataset->AddField($field, false);
            $field = new StringField('kumpulan_perkhidmatan');
            $this->dataset->AddField($field, false);
            $this->dataset->AddLookupField('nama', 'maklumat_staf', new StringField('nama'), new StringField('nama', 'nama_nama', 'nama_nama_maklumat_staf'), 'nama_nama_maklumat_staf');
            $this->dataset->AddLookupField('kategori_kursus', 'kategori_kursus', new StringField('kategori_kursus'), new StringField('kategori_kursus', 'kategori_kursus_kategori_kursus', 'kategori_kursus_kategori_kursus_kategori_kursus'), 'kategori_kursus_kategori_kursus_kategori_kursus');
            $this->dataset->AddLookupField('tempat_kursus', 'tempat_kursus', new StringField('tempat_kursus'), new StringField('tempat_kursus', 'tempat_kursus_tempat_kursus', 'tempat_kursus_tempat_kursus_tempat_kursus'), 'tempat_kursus_tempat_kursus_tempat_kursus');
            $this->dataset->AddLookupField('anjuran', 'anjuran', new StringField('anjuran'), new StringField('anjuran', 'anjuran_anjuran', 'anjuran_anjuran_anjuran'), 'anjuran_anjuran_anjuran');
            $this->dataset->AddLookupField('kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', new StringField('kumpulan_perkhidmatan'), new StringField('kumpulan_perkhidmatan', 'kumpulan_perkhidmatan_kumpulan_perkhidmatan', 'kumpulan_perkhidmatan_kumpulan_perkhidmatan_kumpulan_perkhidmatan'), 'kumpulan_perkhidmatan_kumpulan_perkhidmatan_kumpulan_perkhidmatan');
        }
    
        protected function CreatePageNavigator()
        {
            $result = new CompositePageNavigator($this);
            
            $partitionNavigator = new PageNavigator('pnav', $this, $this->dataset);
            $partitionNavigator->SetRowsPerPage(30);
            $result->AddPageNavigator($partitionNavigator);
            
            return $result;
        }
    
        public function GetPageList()
        {
            $currentPageCaption = $this->GetShortCaption();
            $result = new PageList();
            if (GetCurrentUserGrantForDataSource('maklumat_staf')->HasViewGrant())
                $result->AddPage(new PageLink($this->RenderText('Maklumat Staf'), 'maklumat_staf.php', $this->RenderText('Maklumat Staf'), $currentPageCaption == $this->RenderText('Maklumat Staf')));
            if (GetCurrentUserGrantForDataSource('permohonan_kursus')->HasViewGrant())
                $result->AddPage(new PageLink($this->RenderText('Rekod Kehadiran'), 'permohonan_kursus.php', $this->RenderText('Rekod Kehadiran'), $currentPageCaption == $this->RenderText('Rekod Kehadiran')));
            if (GetCurrentUserGrantForDataSource('maklumat_kursus')->HasViewGrant())
                $result->AddPage(new PageLink($this->RenderText('Training Road Map'), 'maklumat_kursus.php', $this->RenderText('Training Road Map'), $currentPageCaption == $this->RenderText('Training Road Map')));
            
            if ( HasAdminPage() && GetApplication()->HasAdminGrantForCurrentUser() )
              $result->AddPage(new PageLink($this->RenderText('Admin page'), 'phpgen_admin.php', 'Admin page', false, true));
            return $result;
        }
    
        protected function CreateRssGenerator()
        {
            return null;
        }
    
        protected function CreateGridSearchControl($grid)
        {
            $grid->UseFilter = true;
            $grid->SearchControl = new SimpleSearch('permohonan_kursusssearch', $this->dataset,
                array('nama_nama', 'nama_kursus', 'kategori_kursus_kategori_kursus', 'tempat_kursus_tempat_kursus', 'anjuran_anjuran', 'tarikh_mula', 'tarikh_tamat', 'bil_hari', 'tarikh_key_in', 'kumpulan_perkhidmatan_kumpulan_perkhidmatan', 'disahkan'),
                array($this->RenderText('Nama'), $this->RenderText('Nama Kursus'), $this->RenderText('Kategori Kursus'), $this->RenderText('Tempat Kursus'), $this->RenderText('Anjuran'), $this->RenderText('Tarikh Mula'), $this->RenderText('Tarikh Tamat'), $this->RenderText('Bil Hari'), $this->RenderText('Tarikh Key In'), $this->RenderText('Kumpulan Perkhidmatan'), $this->RenderText('Disahkan')),
                array(
                    '=' => $this->GetLocalizerCaptions()->GetMessageString('equals'),
                    '<>' => $this->GetLocalizerCaptions()->GetMessageString('doesNotEquals'),
                    '<' => $this->GetLocalizerCaptions()->GetMessageString('isLessThan'),
                    '<=' => $this->GetLocalizerCaptions()->GetMessageString('isLessThanOrEqualsTo'),
                    '>' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThan'),
                    '>=' => $this->GetLocalizerCaptions()->GetMessageString('isGreaterThanOrEqualsTo'),
                    'ILIKE' => $this->GetLocalizerCaptions()->GetMessageString('Like'),
                    'STARTS' => $this->GetLocalizerCaptions()->GetMessageString('StartsWith'),
                    'ENDS' => $this->GetLocalizerCaptions()->GetMessageString('EndsWith'),
                    'CONTAINS' => $this->GetLocalizerCaptions()->GetMessageString('Contains')
                    ), $this->GetLocalizerCaptions(), $this, 'CONTAINS'
                );
        }
    
        protected function CreateGridAdvancedSearchControl($grid)
        {
            $this->AdvancedSearchControl = new AdvancedSearchControl('permohonan_kursusasearch', $this->dataset, $this->GetLocalizerCaptions(), $this->GetColumnVariableContainer(), $this->CreateLinkBuilder());
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('nama', $this->RenderText('Nama'), $lookupDataset, 'nama', 'nama', false));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('nama_kursus', $this->RenderText('Nama Kursus')));
            
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('kategori_kursus', $this->RenderText('Kategori Kursus'), $lookupDataset, 'kategori_kursus', 'kategori_kursus', false));
            
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('tempat_kursus', $this->RenderText('Tempat Kursus'), $lookupDataset, 'tempat_kursus', 'tempat_kursus', false));
            
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('anjuran', $this->RenderText('Anjuran'), $lookupDataset, 'anjuran', 'anjuran', false));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateDateTimeSearchInput('tarikh_mula', $this->RenderText('Tarikh Mula')));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateDateTimeSearchInput('tarikh_tamat', $this->RenderText('Tarikh Tamat')));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('bil_hari', $this->RenderText('Bil Hari')));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateDateTimeSearchInput('tarikh_key_in', $this->RenderText('Tarikh Key In')));
            
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kumpulan_perkhidmatan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kumpulan_perkhidmatan');
            $lookupDataset->AddField($field, false);
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateLookupSearchInput('kumpulan_perkhidmatan', $this->RenderText('Kumpulan Perkhidmatan'), $lookupDataset, 'kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', false));
            $this->AdvancedSearchControl->AddSearchColumn($this->AdvancedSearchControl->CreateStringSearchInput('disahkan', $this->RenderText('Disahkan')));
        }
    
        protected function AddOperationsColumns($grid)
        {
            $actionsBandName = 'actions';
            $grid->AddBandToBegin($actionsBandName, $this->GetLocalizerCaptions()->GetMessageString('Actions'), true);
            if ($this->GetSecurityInfo()->HasViewGrant())
            {
                $column = $grid->AddViewColumn(new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('View'), OPERATION_VIEW, $this->dataset), $actionsBandName);
            }
            if ($this->GetSecurityInfo()->HasEditGrant())
            {
                $column = $grid->AddViewColumn(new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Edit'), OPERATION_EDIT, $this->dataset), $actionsBandName);
                $column->OnShow->AddListener('ShowEditButtonHandler', $this);
            }
            if ($this->GetSecurityInfo()->HasDeleteGrant())
            {
                $column = $grid->AddViewColumn(new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Delete'), OPERATION_DELETE, $this->dataset), $actionsBandName);
                $column->OnShow->AddListener('ShowDeleteButtonHandler', $this);
            $column->SetAdditionalAttribute("modal-delete", "true");
            $column->SetAdditionalAttribute("delete-handler-name", $this->GetModalGridDeleteHandler());
            }
            if ($this->GetSecurityInfo()->HasAddGrant())
            {
                $column = $grid->AddViewColumn(new RowOperationByLinkColumn($this->GetLocalizerCaptions()->GetMessageString('Copy'), OPERATION_COPY, $this->dataset), $actionsBandName);
            }
        }
    
        protected function AddFieldColumns($grid)
        {
            //
            // View column for nama field
            //
            $column = new TextViewColumn('nama_nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('nama_handler');
            
            /* <inline edit column> */
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_NAME%'));
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('nama_kursus_handler');
            
            /* <inline edit column> */
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth('100px');
            $grid->AddViewColumn($column);
            
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus_kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('kategori_kursus_handler');
            
            /* <inline edit column> */
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus_tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('tempat_kursus_handler');
            
            /* <inline edit column> */
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran_anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('anjuran_handler');
            
            /* <inline edit column> */
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tarikh_mula field
            //
            $column = new DateTimeViewColumn('tarikh_mula', 'Tarikh Mula', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for tarikh_mula field
            //
            $editor = new DateTimeEdit('tarikh_mula_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Mula', 'tarikh_mula', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for tarikh_mula field
            //
            $editor = new DateTimeEdit('tarikh_mula_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Mula', 'tarikh_mula', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tarikh_tamat field
            //
            $column = new DateTimeViewColumn('tarikh_tamat', 'Tarikh Tamat', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for tarikh_tamat field
            //
            $editor = new DateTimeEdit('tarikh_tamat_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Tamat', 'tarikh_tamat', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for tarikh_tamat field
            //
            $editor = new DateTimeEdit('tarikh_tamat_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Tamat', 'tarikh_tamat', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for bil_hari field
            //
            $column = new TextViewColumn('bil_hari', 'Bil Hari', $this->dataset);
            $grid->SetTotal($column, PredefinedAggregate::$Sum);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for bil_hari field
            //
            $editor = new TextEdit('bil_hari_edit');
            $editColumn = new CustomEditColumn('Bil Hari', 'bil_hari', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for bil_hari field
            //
            $editor = new TextEdit('bil_hari_edit');
            $editColumn = new CustomEditColumn('Bil Hari', 'bil_hari', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for tarikh_key_in field
            //
            $column = new DateTimeViewColumn('tarikh_key_in', 'Tarikh Key In', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for tarikh_key_in field
            //
            $editor = new DateTimeEdit('tarikh_key_in_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Key In', 'tarikh_key_in', $editor, $this->dataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for tarikh_key_in field
            //
            $editor = new DateTimeEdit('tarikh_key_in_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Key In', 'tarikh_key_in', $editor, $this->dataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_DATE%'));
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for kumpulan_perkhidmatan field
            //
            $column = new TextViewColumn('kumpulan_perkhidmatan_kumpulan_perkhidmatan', 'Kumpulan Perkhidmatan', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for kumpulan_perkhidmatan field
            //
            $editor = new RadioEdit('kumpulan_perkhidmatan_edit');
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kumpulan_perkhidmatan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kumpulan_perkhidmatan');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kumpulan_perkhidmatan', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kumpulan Perkhidmatan', 
                'kumpulan_perkhidmatan', 
                $editor, 
                $this->dataset, 'kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', $lookupDataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for kumpulan_perkhidmatan field
            //
            $editor = new RadioEdit('kumpulan_perkhidmatan_edit');
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kumpulan_perkhidmatan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kumpulan_perkhidmatan');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kumpulan_perkhidmatan', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kumpulan Perkhidmatan', 
                'kumpulan_perkhidmatan', 
                $editor, 
                $this->dataset, 'kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', $lookupDataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column = new CheckBoxFormatValueViewColumnDecorator($column);
            $column->SetDisplayValues('<img src="images/checked.png" alt="true">', '');
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
            
            //
            // View column for disahkan field
            //
            $column = new TextViewColumn('disahkan', 'Disahkan', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for disahkan field
            //
            $editor = new TextAreaEdit('disahkan_edit', 50, 8);
            $editColumn = new CustomEditColumn('Disahkan', 'disahkan', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for disahkan field
            //
            $editor = new TextAreaEdit('disahkan_edit', 50, 8);
            $editColumn = new CustomEditColumn('Disahkan', 'disahkan', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $column->SetDescription($this->RenderText(''));
            $column->SetFixedWidth(null);
            $grid->AddViewColumn($column);
			
			//echo $this->JSCalculateDay();
        }
    
        protected function AddSingleRecordViewColumns($grid)
        {
            //
            // View column for nama field
            //
            $column = new TextViewColumn('nama_nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('nama_handler');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('nama_kursus_handler');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus_kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('kategori_kursus_handler');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus_tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('tempat_kursus_handler');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran_anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            $column->SetMaxLength(75);
            $column->SetFullTextWindowHandlerName('anjuran_handler');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tarikh_mula field
            //
            $column = new DateTimeViewColumn('tarikh_mula', 'Tarikh Mula', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tarikh_tamat field
            //
            $column = new DateTimeViewColumn('tarikh_tamat', 'Tarikh Tamat', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for bil_hari field
            //
            $column = new TextViewColumn('bil_hari', 'Bil Hari', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for tarikh_key_in field
            //
            $column = new DateTimeViewColumn('tarikh_key_in', 'Tarikh Key In', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for disahkan field
            //
            $column = new TextViewColumn('disahkan', 'Disahkan', $this->dataset);
            $column->SetOrderable(true);
            $column = new CheckBoxFormatValueViewColumnDecorator($column);
            $column->SetDisplayValues('<img src="images/checked.png" alt="true">', '');
            $grid->AddSingleRecordViewColumn($column);
            
            //
            // View column for kumpulan_perkhidmatan field
            //
            $column = new TextViewColumn('kumpulan_perkhidmatan_kumpulan_perkhidmatan', 'Kumpulan Perkhidmatan', $this->dataset);
            $column->SetOrderable(true);
            $column = new CheckBoxFormatValueViewColumnDecorator($column);
            $column->SetDisplayValues('<img src="images/checked.png" alt="true">', '');
            $grid->AddSingleRecordViewColumn($column);
        }
    
        protected function AddEditColumns($grid)
        {
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
			
			//echo $this->JSCalculateDay();
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tarikh_mula field
            //
            $editor = new DateTimeEdit('tarikh_mula_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Mula', 'tarikh_mula', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tarikh_tamat field
            //
            $editor = new DateTimeEdit('tarikh_tamat_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Tamat', 'tarikh_tamat', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for bil_hari field
            //
            $editor = new TextEdit('bil_hari_edit');
            $editColumn = new CustomEditColumn('Bil Hari', 'bil_hari', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for tarikh_key_in field
            //
            $editor = new DateTimeEdit('tarikh_key_in_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Key In', 'tarikh_key_in', $editor, $this->dataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for disahkan field
            //
            $editor = new ComboBox('disahkan_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`disahkan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('disahkan');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('id', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Disahkan', 
                'disahkan', 
                $editor, 
                $this->dataset, 'disahkan', 'id', $lookupDataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
            
            //
            // Edit column for kumpulan_perkhidmatan field
            //
            $editor = new RadioEdit('kumpulan_perkhidmatan_edit');
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kumpulan_perkhidmatan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kumpulan_perkhidmatan');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kumpulan_perkhidmatan', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kumpulan Perkhidmatan', 
                'kumpulan_perkhidmatan', 
                $editor, 
                $this->dataset, 'kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', $lookupDataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddEditColumn($editColumn);
        }
    
        protected function AddInsertColumns($grid)
        {
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_NAME%'));
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for kumpulan_perkhidmatan field
            //
            $editor = new RadioEdit('kumpulan_perkhidmatan_edit');
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kumpulan_perkhidmatan`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kumpulan_perkhidmatan');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kumpulan_perkhidmatan', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kumpulan Perkhidmatan', 
                'kumpulan_perkhidmatan', 
                $editor, 
                $this->dataset, 'kumpulan_perkhidmatan', 'kumpulan_perkhidmatan', $lookupDataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tarikh_mula field
            //
            $editor = new DateTimeEdit('tarikh_mula_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Mula', 'tarikh_mula', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tarikh_tamat field
            //
            $editor = new DateTimeEdit('tarikh_tamat_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Tamat', 'tarikh_tamat', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for bil_hari field
            //
            $editor = new TextEdit('bil_hari_edit');
            $editColumn = new CustomEditColumn('Bil Hari', 'bil_hari', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for tarikh_key_in field
            //
            $editor = new DateTimeEdit('tarikh_key_in_edit', true, 'd-m-Y H:i:s', 0);
            $editColumn = new CustomEditColumn('Tarikh Key In', 'tarikh_key_in', $editor, $this->dataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_DATE%'));
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            
            //
            // Edit column for disahkan field
            //
            $editor = new CheckBox('disahkan_edit');
            $editor->SetCustomAttributes('Ya');
            $editColumn = new CustomEditColumn('Disahkan Benar Maklumat Di Atas.', 'disahkan', $editor, $this->dataset);
            $validator = new RequiredValidator(StringUtils::Format($this->GetLocalizerCaptions()->GetMessageString('RequiredValidationMessage'), $this->RenderText($editColumn->GetCaption())));
            $editor->GetValidatorCollection()->AddValidator($validator);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $grid->AddInsertColumn($editColumn);
            if ($this->GetSecurityInfo()->HasAddGrant())
            {
                $grid->SetShowAddButton(true);
                $grid->SetShowInlineAddButton(false);
            }
            else
            {
                $grid->SetShowInlineAddButton(false);
                $grid->SetShowAddButton(false);
            }
        }
    
        protected function AddPrintColumns($grid)
        {
            //
            // View column for nama field
            //
            $column = new TextViewColumn('nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            $column = new CheckBoxFormatValueViewColumnDecorator($column);
            $column->SetDisplayValues('<img src="images/checked.png" alt="true">', '');
            $grid->AddPrintColumn($column);
            
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for tarikh_mula field
            //
            $column = new DateTimeViewColumn('tarikh_mula', 'Tarikh Mula', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for tarikh_tamat field
            //
            $column = new DateTimeViewColumn('tarikh_tamat', 'Tarikh Tamat', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for bil_hari field
            //
            $column = new TextViewColumn('bil_hari', 'Bil Hari', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for tarikh_key_in field
            //
            $column = new DateTimeViewColumn('tarikh_key_in', 'Tarikh Key In', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for disahkan field
            //
            $column = new TextViewColumn('disahkan', 'Disahkan', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
            
            //
            // View column for kumpulan_perkhidmatan field
            //
            $column = new TextViewColumn('kumpulan_perkhidmatan', 'Kumpulan Perkhidmatan', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddPrintColumn($column);
        }
    
        protected function AddExportColumns($grid)
        {
            //
            // View column for nama field
            //
            $column = new TextViewColumn('nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for tarikh_mula field
            //
            $column = new DateTimeViewColumn('tarikh_mula', 'Tarikh Mula', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for tarikh_tamat field
            //
            $column = new DateTimeViewColumn('tarikh_tamat', 'Tarikh Tamat', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for bil_hari field
            //
            $column = new TextViewColumn('bil_hari', 'Bil Hari', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for tarikh_key_in field
            //
            $column = new DateTimeViewColumn('tarikh_key_in', 'Tarikh Key In', $this->dataset);
            $column->SetDateTimeFormat('Y-m-d');
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for disahkan field
            //
            $column = new TextViewColumn('disahkan', 'Disahkan', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
            
            //
            // View column for kumpulan_perkhidmatan field
            //
            $column = new TextViewColumn('kumpulan_perkhidmatan', 'Kumpulan Perkhidmatan', $this->dataset);
            $column->SetOrderable(true);
            $grid->AddExportColumn($column);
        }
    
        public function GetPageDirection()
        {
            return null;
        }
    
        protected function ApplyCommonColumnEditProperties($column)
        {
            $column->SetShowSetToNullCheckBox(false);
    	$column->SetVariableContainer($this->GetColumnVariableContainer());
        }
    
        function BeforeBeginRenderPage()
        {
            if ($this->GetRecordPermission() != null)
        	       if (!$this->GetRecordPermission()->CanAllUsersViewRecords())
                     if (GetApplication()->GetCurrentUserId() == null)
                         $this->dataset->AddFieldFilter('id', new IsNullFieldFilter());
                     else
        		             $this->dataset->AddFieldFilter('id', new FieldFilter(GetApplication()->GetCurrentUserId(), '='));
							 //echo $this->JSCalculateDay();
        }
		
		function JSCalculateDay(){
			$script = '<script type="text/javascript">'.
				'$(document).ready(funtion(){
					$("#tarikh_mula_edit").change(function(){
						calculateDay();
					});
					$("#tarikh_mula_edit").click(function(){
						calculateDay();
					});
					function calculateDay(){
						var date1 = $("#tarikh_mula_edit").val();
						var date2 = $("#tarikh_tamat_edit")val();
						alert(date1+" "+date1);
					}
				});';
			$script .= '</script>';
			return $script;
		}
        
        function GetCustomClientScript()
        {
			return ;
        }
        
        function GetOnPageLoadedClientScript()
        {
            $script = ''.
				'
					$("#tarikh_mula_edit").keyup(function(){
						calculateDay();
					});
					$("#tarikh_tamat_edit").blur(function(){
						calculateDay();
					});
					$("#bil_hari_edit").click(function(){
						calculateDay();
					});
					function calculateDay(){
						var date1 = $("#tarikh_mula_edit").val().split("-");
						var date2 = $("#tarikh_tamat_edit").val().split("-");
						
						var tarikh1 = new Date(date1[2].split(" ")[0], date1[1], date1[0]);
						var tarikh2 = new Date(date2[2].split(" ")[0],date2[1], date2[0]);
						//alert(tarikh1+" "+tarikh2);
						
						var diff = new Date(tarikh2 - tarikh1);
						// get days
						var days = diff/1000/60/60/24;
						//alert(days);
						$("#bil_hari_edit").val(days);
					}
				';
			$script .= '';
			return $script;
        }
        public function ShowEditButtonHandler($show)
        {
            if ($this->GetRecordPermission() != null)
                $show = $this->GetRecordPermission()->HasEditGrant($this->GetDataset());
        }
        public function ShowDeleteButtonHandler($show)
        {
            if ($this->GetRecordPermission() != null)
                $show = $this->GetRecordPermission()->HasDeleteGrant($this->GetDataset());
        }
        
        public function GetModalGridDeleteHandler() { return 'permohonan_kursus_modal_delete'; }
        protected function GetEnableModalGridDelete() { return true; }
    
        protected function CreateGrid()
        {
            $result = new Grid($this, $this->dataset, 'permohonan_kursusGrid');
            if ($this->GetSecurityInfo()->HasDeleteGrant())
               $result->SetAllowDeleteSelected(true);
            else
               $result->SetAllowDeleteSelected(false);   
            
            ApplyCommonPageSettings($this, $result);
            
            $result->SetUseImagesForActions(false);
            $result->SetUseFixedHeader(false);
            
            $result->SetShowLineNumbers(false);
            
            $result->SetHighlightRowAtHover(false);
            $result->SetWidth('');
            $this->CreateGridSearchControl($result);
            $this->CreateGridAdvancedSearchControl($result);
            $this->AddOperationsColumns($result);
            $this->AddFieldColumns($result);
            $this->AddSingleRecordViewColumns($result);
            $this->AddEditColumns($result);
            $this->AddInsertColumns($result);
            $this->AddPrintColumns($result);
            $this->AddExportColumns($result);
    
            $this->SetShowPageList(true);
            $this->SetExportToExcelAvailable(true);
            $this->SetExportToWordAvailable(false);
            $this->SetExportToXmlAvailable(false);
            $this->SetExportToCsvAvailable(false);
            $this->SetExportToPdfAvailable(true);
            $this->SetPrinterFriendlyAvailable(true);
            $this->SetSimpleSearchAvailable(true);
            $this->SetAdvancedSearchAvailable(true);
            $this->SetVisualEffectsEnabled(true);
            $this->SetShowTopPageNavigator(true);
            $this->SetShowBottomPageNavigator(true);
    
            //
            // Http Handlers
            //
            //
            // View column for nama field
            //
            $column = new TextViewColumn('nama_nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for nama field
            //
            $editor = new ComboBox('nama_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`maklumat_staf`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('nama');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('noic');
            $lookupDataset->AddField($field, false);
            $field = new StringField('gred');
            $lookupDataset->AddField($field, false);
            $field = new StringField('jawatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_jabatan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('cawangan');
            $lookupDataset->AddField($field, false);
            $field = new StringField('nama_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_mula');
            $lookupDataset->AddField($field, false);
            $field = new DateField('tarikh_tamat');
            $lookupDataset->AddField($field, false);
            $field = new IntegerField('bil_hari');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('nama', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Nama', 
                'nama', 
                $editor, 
                $this->dataset, 'nama', 'nama', $lookupDataset);
            $editColumn->SetReadOnly(true);
            $editColumn->SetAllowSetToNull(true);
            $editColumn->SetInsertDefaultValue($this->RenderText('%CURRENT_USER_NAME%'));
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'nama_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for nama_kursus field
            //
            $editor = new HtmlWysiwygEditor('nama_kursus_edit');
            $editor->SetAllowColorControls(true);
            $editColumn = new CustomEditColumn('Nama Kursus', 'nama_kursus', $editor, $this->dataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'nama_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus_kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for kategori_kursus field
            //
            $editor = new ComboBox('kategori_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`kategori_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('kategori_kursus');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('kategori_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Kategori Kursus', 
                'kategori_kursus', 
                $editor, 
                $this->dataset, 'kategori_kursus', 'kategori_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'kategori_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus_tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for tempat_kursus field
            //
            $editor = new ComboBox('tempat_kursus_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`tempat_kursus`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('tempat_kursus');
            $lookupDataset->AddField($field, false);
            $field = new StringField('negeri');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('tempat_kursus', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Tempat Kursus', 
                'tempat_kursus', 
                $editor, 
                $this->dataset, 'tempat_kursus', 'tempat_kursus', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'tempat_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran_anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            
            /* <inline edit column> */
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetEditOperationColumn($editColumn);
            /* </inline edit column> */
            
            /* <inline insert column> */
            //
            // Edit column for anjuran field
            //
            $editor = new ComboBox('anjuran_edit', $this->GetLocalizerCaptions()->GetMessageString('PleaseSelect'));
            $lookupDataset = new TableDataset(
                new MySqlIConnectionFactory(),
                GetConnectionOptions(),
                '`anjuran`');
            $field = new IntegerField('id', null, null, true);
            $lookupDataset->AddField($field, true);
            $field = new StringField('anjuran');
            $lookupDataset->AddField($field, false);
            $lookupDataset->SetOrderBy('anjuran', GetOrderTypeAsSQL(otAscending));
            $editColumn = new LookUpEditColumn(
                'Anjuran', 
                'anjuran', 
                $editor, 
                $this->dataset, 'anjuran', 'anjuran', $lookupDataset);
            $editColumn->SetAllowSetToNull(true);
            $this->ApplyCommonColumnEditProperties($editColumn);
            $column->SetInsertOperationColumn($editColumn);
            /* </inline insert column> */
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'anjuran_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);//
            // View column for nama field
            //
            $column = new TextViewColumn('nama_nama', 'Nama', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'nama_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for nama_kursus field
            //
            $column = new TextViewColumn('nama_kursus', 'Nama Kursus', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'nama_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for kategori_kursus field
            //
            $column = new TextViewColumn('kategori_kursus_kategori_kursus', 'Kategori Kursus', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'kategori_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for tempat_kursus field
            //
            $column = new TextViewColumn('tempat_kursus_tempat_kursus', 'Tempat Kursus', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'tempat_kursus_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
            //
            // View column for anjuran field
            //
            $column = new TextViewColumn('anjuran_anjuran', 'Anjuran', $this->dataset);
            $column->SetOrderable(true);
            $handler = new ShowTextBlobHandler($this->dataset, $this, 'anjuran_handler', $column);
            GetApplication()->RegisterHTTPHandler($handler);
			
			
            return $result;
        }
        
        protected function OpenAdvancedSearchByDefault()
        {
            return false;
        }
    
        protected function DoGetGridHeader()
        {
            return '';
        }
    }

    SetUpUserAuthorization(GetApplication());

    try
    {
        $Page = new permohonan_kursusPage("permohonan_kursus.php", "permohonan_kursus", GetCurrentUserGrantForDataSource("permohonan_kursus"), 'UTF-8');
        $Page->SetShortCaption('Rekod Kehadiran');
        $Page->SetHeader(GetPagesHeader());
        $Page->SetFooter(GetPagesFooter());
        $Page->SetCaption('Rekod Kehadiran');
        $Page->SetRecordPermission(GetCurrentUserRecordPermissionsForDataSource("permohonan_kursus"));

        GetApplication()->SetMainPage($Page);
        GetApplication()->Run();
    }
    catch(Exception $e)
    {
        ShowErrorPage($e->getMessage());
    }

?>
